//////////////////////////////////////////////////////////////////////////
//	File: Render.h
//
//	Author:	Omar Khan
//
//	Created: January 11, 2010
//
//	Purpose: Application framework that will create the window, update, 
//			 and render the game as well as clean up as necessary
//////////////////////////////////////////////////////////////////////////
#pragma once
#include <windows.h>
#include <d3dx9.h>
#include "Mesh.h"
#include "Camera.h"
#include "SkinnedMesh.h"
#include "Shader.h"

#define KEYDOWN(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 1 : 0)
#define KEYUP(vk_code) ((GetAsyncKeyState(vk_code) & 0x8000) ? 0 : 1)

class CRender
{
private:
	IDirect3DDevice9* m_pDevice;
	CCamera m_Camera;
	CSkinnedMesh m_SkinnedMesh;
	BONE* m_pHand;

	CMesh m_Weapons[4];
	int m_nActiveWeapon;

	bool m_bWireFrame, m_bShowSkeleton;
	float m_fAngle, m_fTime;
	D3DXVECTOR3 m_HandOffset;
	std::vector<std::string> m_vAnimations;
	int m_nActiveAnimation;

	D3DLIGHT9 m_Light;
	ID3DXFont* m_pFont;

	//	Shaders
	CShader m_unitVS, m_unitPS;
	D3DXHANDLE m_worldHandle, m_viewProjHandle, m_sunHandle;


public:
	CRender();
	~CRender();


	void Init(IDirect3DDevice9* m_pDevice, HWND wnd);
	void Update(float fDTime, IDirect3DDevice9* m_pDevice);
	HRESULT Render(IDirect3DDevice9* m_pDevice);
	void Cleanup();
	void Quit();
	DWORD FtoDword(float f) {return *((DWORD*)&f);}

};


